/**
 * 登 陆
 */
// Ext.BLANK_IMAGE_URL = '/lams/image/pic/blank.gif';
Ext.onReady(function() {
	Ext.QuickTips.init();
	Ext.lib.Ajax.defaultPostHeader += ";charset=utf-8";
	Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
	Ext.form.Field.prototype.msgTarget = "side";
	var path = Utils.getPath();
	var _fp = new Ext.FormPanel({
				renderTo : 'loginpanel',
				// region : "center",
				labelWidth : 60,
				plain : true,
				width : 400,
				height : 174,
				// style : 'background:#ffffff;padding:25px 35px 30px
				// 16px;',
				baseCls : 'ex-panel',
				// cls:'login-form',
				style : 'padding:50px 20px 40px 100px;',
				url : "login.action",
				method : "POST",
				waitMsgTarget : true,
				defaults : {
					border : false,
					msgTarget : 'side'
				},
				buttonAlign : 'center',
				listeners : {
					"actioncomplete" : function(_form, _action) {
						document.location = Utils.getPath() + "/jsp/main.html";
					},
					"actionfailed" : function(_form, _action) {
						var result = Ext.util.JSON
								.decode(_action.response.responseText.trim());
						// Ext.Msg.alert("提示信息", result.message);
						H.Msg.error(result.message);
					}
				},
				items : [{
							xtype : "textfield",
							name : "USER_NO",
							allowBlank : false,
							blankText : "账号不能为空",
							fieldLabel : "账号"
						}, {
							xtype : "textfield",
							name : "PASSWORD",
							inputType : 'password',
							allowBlank : false,
							blankText : "密码不能为空",
							fieldLabel : "密码"
						}
				/*
				 * , { xtype : 'panel', layout : 'column', items : [{ width :
				 * 130, layout : 'form', border : false, items : [{ fieldLabel :
				 * '效验码', name : 'checkCode', xtype : 'textfield', // vtype :
				 * 'checkCode', allowBlank : false, msgTarget : 'side',
				 * blankText : '该字段不允许为空', anchor : '98%' }] }, { xtype :
				 * 'checkCode', src : 'checkCodeImg.action', width : 60, height :
				 * 20, handler : true }] }
				 */
				],
				buttons : [{
							text : "登陆",
							handler : function() {
								if (_fp.form.isValid()) {
									_fp.form.submit({
												waitMsg : "正在登陆..."
											});
								}
							}
						}]
			});
	
	var map = new Ext.KeyMap(document, {
				key : Ext.EventObject.ENTER,
				fn : function(e) {
					//H.Msg.info("点了回车");
					if (_fp.form.isValid()) {
						_fp.form.submit({
									waitMsg : "正在登陆..."
								});
					}
				},
				scope : document,
				stopEvent : false
			});

		_fp.el.center();
		 Ext.get('index_bg').center();

	});
